package 早晨练习0314;

import 晚间作业0309.Doc07;

public class ShapeContainer {

    public interface InterComparator {
        double compare(ShapeContainer.Circle circle, ShapeContainer.Point point);
    }

    public static class Point {
        private double x;
        private double y;

        public Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        public double getDistanceOfPoint(Point p) {
            return Math.sqrt(Math.pow(x - p.x, 2) + Math.pow(y - p.y, 2));
        }
    }

    public static class Circle {
        private Point center;
        private double radius;

        public Circle(Point center, double radius) {
            this.center = center;
            this.radius = radius;
        }

        public Point getCenter() {
            return center;
        }

        public double getRadius() {
            return radius;
        }

        public void print(Point point, InterComparator comparator) {
            double result = comparator.compare(this, point);
            if (result > 0) {
                System.out.println("点在圆外");
            } else if (result == 0) {
                System.out.println("点在圆上");
            } else {
                System.out.println("点在园内");
            }
        }
    }
}
